/**
 *  Copyright (c) 2011, IPC Studio, USTC, All rights reserved
 *  FileName: Lyrics.cpp
 *  Author: chengximing1989@gmail.com
 *  DateCreated: 2011-3-23
 */

#include "../include/Lyrics.h"

LIBLYRICS_NAMESPACE_BEGIN

CLyrics::CLyrics(void)
{
	m_alllrc.clear();
	m_veclrcheadinfo.clear();
	m_plrcfile = NULL;
	m_offset = 0;
	m_pencoder = new TxtEncoder();
}

CLyrics::~CLyrics(void)
{
	if(m_plrcfile)
		fclose(m_plrcfile);
	if(m_pencoder)
		delete m_pencoder;
}

vector<string> CLyrics::GetLrcHeadInfo()
{
	return m_veclrcheadinfo;
}

vector<LrcRecord> CLyrics::GetLrcRecord()
{
	return m_veclrcrec;
}

int CLyrics::Getoffset()
{
	return m_offset;
}

bool CLyrics::ClearAll()
{
	m_alllrc.clear();
	m_plrcfile = NULL;
	m_veclrcrec.clear();
	m_veclrcheadinfo.clear();
	return true;
}

string CLyrics::GetLibVersion()
{
	char mainversion[3], subversion[3], minversion[3];
	string out = "\nCopyRight 2011 IPC Studio\nliblyrics ";
	itoa(LIBLYRICSMVER, mainversion, 10);
	itoa(LIBLYRICSSVER, subversion, 10);
	itoa(LIBLYRICSMINVER, minversion, 10);
	out += mainversion;
	out += ".";
	out += subversion;
	out += ".";
	out += minversion;
	out += " ";
	out += (LIBLYRICSBETA ? "beta" : "stable");
	out += " ";
#ifdef WIN32
	out += "for Windows 32 bit";
#else
	out += "for Linux";
#endif
	out += "\nBuild Date & Time ";
	out += __DATE__;
	out += " ";
	out += __TIME__;
	return out;
}

LIBLYRICS_NAMESPACE_END
